<extend name="Public/base"/>

<block name="body">

	<div class="main-title">
		<h2>分账列表</h2>
	</div>

    <div class="cf">
        <div class="fl">
            <a class="btn"href="http://qnm.upslope.cn/index.php?m=Admin&c=Alipay&a=split&type=1" >查看失败订单</a>
            <php>
                $time1=strtotime(date("Ymd"));
                $time2=strtotime(date("Ymd",time()+86400));
                $map=array('_string' => "`sub_msg` is not null and `sub_msg` !='' and time between $time1 and $time2");
                $one=D('Split')->where($map)->select();
                if(!empty($one)){
                    echo '<span style="color:red;font-size:14px;">有失败订单！</span>';
                }
            </php>
            
        </div>
    </div>

	<div class="data-table table-striped" >
		<table style="font-size:14px;">
			<thead>
				<tr>
                    <th class="row-selected row-selected"><input class="check-all" type="checkbox"/></th>
					<th>ID</th>
					<th>姓名</th>
                    <th>口碑user_id</th>
                    <th>入账金额</th>
                    <th>交易金额</th>
                    <th>平台交易号</th>
                    <th>支付宝交易号</th>
                    <th>商户收益</th>
                    <th>分账时间</th>
                    <th>状态</th>
                    <th>失败原因</th>
				</tr>
			</thead>
			<tbody>
				<notempty name="_list">
				<volist name="_list" id="rows">
					<tr>
                        <td><input class="ids" type="checkbox" name="id[]" value="{$rows['id']}" /></td>
                        
						<td>{$rows['id']}</td>
						<td>{$rows['name']}</td>
                        <td>{$rows['seller_id']}</td>
                        <td>{$rows['money_in']}</td>
                        <td>{$rows['money_out']}</td>
                        <td>{$rows['out_request_no']}</td>
                        <td>{$rows['trade_no']}</td>
                        <td>{$rows['sh_money']}</td>
                        <td>
                            <php>
                                echo date("Y-m-d H:i:s",$rows['time']);
                            
                            </php>
                        </td>
                        <td>
                            <php>
                                if($rows['status']==0){
                                    echo '失败';
                                }else{
                                    echo '成功';
                                }
                            </php>
                        </td>
                        <td>{$rows['sub_msg']}</td>
					</tr>
				</volist>
				<else/>
				<td colspan="14" class="text-center"> aOh! 暂时还没有内容! </td>
				</notempty>
			</tbody>
		</table>



	</div>

    <div class="page"  style="float:left;margin-right:300px;">{$_page}</div>
</block>

<block name="script">
    <link href="/Public/static/datetimepicker/css/datetimepicker.css" rel="stylesheet" type="text/css">
    <link href="/Public/static/datetimepicker/css/dropdown.css" rel="stylesheet" type="text/css">
    <script type="text/javascript" src="/Public/static/datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
    <script type="text/javascript" src="/Public/static/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js" charset="UTF-8"></script>
<script type="text/javascript">
    $(function(){
         Think.setValue("extend", {$info.extend|default=0});
            //导航高亮
            highlight_subnav('{:U('split')}');

        //搜索功能
        $("#search").click(function(){
            var url = $(this).attr('url');
            var status = $("#sch-sort-txt").attr("data");
            var type   = $("#sch-sort-txt_type").attr("data");
            var query  = $('.search-form').find('input').serialize();
            query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g,'');
            query = query.replace(/^&/g,'');
            if(status != ''){
                query += '&status=' + status + "&" + query;
            }
            if(type != ''){
                query += '&type=' + type + "&" + query;
            }
            if( url.indexOf('?')>0 ){
                url += '&' + query;
            }else{
                url += '?' + query;
            }
            window.location.href = url;
        });





        /* 状态搜索子菜单 */
        $(".search-form").find(".drop-down1").hover(function(){
            $("#sub-sch-menu").removeClass("hidden");
        },function(){
            $("#sub-sch-menu").addClass("hidden");
        });
        $("#sub-sch-menu li").find("a").each(function(){
            $(this).click(function(){
                var text = $(this).text();
                $("#sch-sort-txt").text(text).attr("data",$(this).attr("value"));
                $("#sub-sch-menu").addClass("hidden");
            })
        });

        $(".search-form").find(".drop-down_type").hover(function(){
            $("#sub-sch-menu_type").removeClass("hidden");
        },function(){
            $("#sub-sch-menu_type").addClass("hidden");
        });

        $("#sub-sch-menu_type li").find("a").each(function(){
            $(this).click(function(){
                var text = $(this).text();
                $("#sch-sort-txt_type").text(text).attr("data",$(this).attr("value"));
                $("#sub-sch-menu_type").addClass("hidden");
            })
        });
        $('#time-start').datetimepicker({
            format: 'yyyy-mm-dd',
            language:"zh-CN",
            minView:2,
            autoclose:true
        });

        $('#time-end').datetimepicker({
            format: 'yyyy-mm-dd',
            language:"zh-CN",
            minView:2,
            autoclose:true
        });




        $('.kouk').click(function(){
            obj = document.getElementsByClassName("ids");
            // console.log(obj)
            check_val = [];
            for(k in obj){
                if(obj[k].checked)
                    check_val.push(obj[k].value);
            }
            $.ajax({
                type:'post',
                data:{'ids':check_val},
                // dataType:'json',
                url:"index.php?m=admin&c=capital&a=kouk",
                success:function(m){
                    alert(m)
                        // alert("提交扣款人数："+ids+"，成功："+success+"，失败："+default+"。失败合同号："+ht+"对应失败原因："+error)
                }
            })
        })




        $('.yanqi').click(function(){
            alert(0)
        })












    })


</script>
</block>